import Vue from 'vue';
import Vuex from 'vuex';
import createPersistedState from 'vuex-persistedstate';

// member
import member from './modules/member';
// recharge
import recharge from './modules/recharge';
// shop
import shop from './modules/shop';
// shop bag
import shopBag from './modules/shopbag';
// shop detail
import shopDetail from './modules/shopDetail';
// shop order
import shopOrder from './modules/shopOrder';
// shop review
import shopReview from './modules/shopReview';
// shop special
import shopSpecial from './modules/shopSpecial';
// shop address
import shopAddress from './modules/shopAddress';
// shop member
import shopMember from './modules/shopMember';
// 地址
import address from './modules/address';
// 分类
import classify from './modules/classify';
// 详情
import detail from './modules/detail';
// 专场
import special from './modules/special';
// 专区
import prefecture from './modules/prefecture';
// 确认订单
import review from './modules/review';
// 订单详情
import orderDetail from './modules/orderDetail';

Vue.use(Vuex);

const vuexStore = new Vuex.Store({
    plugins: [createPersistedState({
        paths: [
            'address',
            'shop',
            'shopBag',
            'shopOrder',
            'shopReview',
            'shopSpecial',
            'shopDetail',
            'shopAddress',
            'shopMember',
            'classify',
            'detail',
            'special',
            'prefecture',
            'review',
            'orderDetail',
        ],
        storage: window.sessionStorage
    })],
    modules: {
        address,
        member,
        recharge,
        shop,
        shopBag,
        shopOrder,
        shopReview,
        shopSpecial,
        shopDetail,
        shopAddress,
        shopMember,
        classify,
        detail,
        special,
        prefecture,
        review,
        orderDetail,
    },
});

export default vuexStore;
